package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.Finance;
import com.woniu.finance.entity.RequestParam;
import com.woniu.finance.service.IFinanceService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 融资企业表 前端控制器
 * </p>
 *
 * @author 刘品水
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/finance")
public class FinanceController {
    @Autowired
    private IFinanceService financeService;

    /**
     * @Description: 保存融资企业表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @PostMapping("saveFinance")
    @OperationLogAnnotation(operModul = "融资企业-保存融资企业表",operType = "新增",operDesc = "保存融资企业表")//操作日志注解
    public HttpResult<?> saveFinance(@RequestBody Finance finance) {

        return financeService.saveFinance(finance);
    }

    /**
     * @Description: 根据id删除融资企业表表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("removeFinanceById")
    @OperationLogAnnotation(operModul = "融资企业-根据enterpriseId删除融资企业表",operType = "删除",operDesc = "根据enterpriseId删除融资企业表")//操作日志注解
    public HttpResult<?> removeFinanceById(String enterpriseId) {
        return financeService.removeFinanceById(enterpriseId);
    }

    /**
     * @Description: 修改融资企业表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */

    @RequestMapping("modifyFinance")
    @OperationLogAnnotation(operModul = "融资企业-修改融资企业表",operType = "修改",operDesc = "修改融资企业表")//操作日志注解
    public HttpResult<?> modifyFinance(@RequestBody Finance finance) {
        return financeService.modifyFinance(finance);
    }

    /**
     * @Description: 根据id查询融资企业表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findFinanceById")
    @OperationLogAnnotation(operModul = "融资企业-根据id查询融资企业表",operType = "查询",operDesc = "根据id查询融资企业表")//操作日志注解
    public HttpResult<?> findFinanceById(String enterpriseId) {
        return financeService.findFinanceById(enterpriseId);
    }

    /**
     * @Description: 查询所有融资企业表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findAllFinance")
    @OperationLogAnnotation(operModul = "融资企业-查询所有融资企业表",operType = "查询",operDesc = "查询所有融资企业表")//操作日志注解
    public HttpResult<?> findAllFinance() {
        return financeService.findAllFinance();
    }

    @PostMapping("/queryFinanceInfoByPage")
    @OperationLogAnnotation(operModul = "融资企业-分页查询所有融资企业表",operType = "查询",operDesc = "分页查询所有融资企业表")//操作日志注解
    public HttpResult<?> queryFinanceInfoByPage(@RequestBody RequestParam<Finance> param) {
        return financeService.queryFinanceInfoByPage(param);
    }
    /**
     *  关联推荐记录表 通过企业名称查询
     * @param param
     * @return
     * @Author:杨顺
     */
    @PostMapping("/queryFinanceIntoPlatformAuditRecord")
    public HttpResult queryFinanceIntoPlatformAuditRecord(@RequestBody RequestParam<Finance> param){
        return financeService.queryFinanceIntoPlatformRecommendationRecord(param);
    }

    /**
     * 根据id集合 分页 查询融资企业信息
     * @param param 融资企业id集合
     * @return
     */
    @PostMapping("findFinanceByListId")
    @OperationLogAnnotation(operModul = "融资企业-根据id集合查询融资企业表",operType = "查询",operDesc = "根据id查询融资企业表")//操作日志注解
    public HttpResult<?> findFinanceByListId(@RequestBody RequestParam<List> param) {
        return financeService.findFinanceByListId(param);
    }


    /**
     * 根据企业名称模糊查询企业信息
     * @param param
     * @return
     */
    @PostMapping("findListFinanceByName")
    @OperationLogAnnotation(operModul = "融资企业-根据融资企业名称模糊查询企业信息",operType = "查询",operDesc = "根据融资企业名称模糊查询")//操作日志注解
    public HttpResult<?> findListFinanceByName(@RequestBody  RequestParam<Finance> param){
        return financeService.findListFinanceByName(param);
    }


}
